package com.inmobi.commons.thinICE.location;

import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import java.util.HashMap;

public final class LocationUtil
{
  private static LocationInfo a(Context paramContext, String paramString)
  {
    Location localLocation = ((LocationManager)paramContext.getSystemService("location")).getLastKnownLocation(paramString);
    if (localLocation == null)
      return null;
    LocationInfo localLocationInfo = new LocationInfo();
    localLocationInfo.time = localLocation.getTime();
    localLocationInfo.provider = localLocation.getProvider();
    localLocationInfo.latitude = localLocation.getLatitude();
    localLocationInfo.longitude = localLocation.getLongitude();
    localLocationInfo.accuracy = localLocation.getAccuracy();
    return localLocationInfo;
  }

  public static HashMap<String, LocationInfo> getLastKnownLocations(Context paramContext)
  {
    HashMap localHashMap = new HashMap();
    if (hasFineLocationPermission(paramContext))
      localHashMap.put("gps", a(paramContext, "gps"));
    if (hasCoarseLocationPermission(paramContext))
      localHashMap.put("network", a(paramContext, "network"));
    return localHashMap;
  }

  public static boolean hasCoarseLocationPermission(Context paramContext)
  {
    return paramContext.checkCallingOrSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == 0;
  }

  public static boolean hasFineLocationPermission(Context paramContext)
  {
    return paramContext.checkCallingOrSelfPermission("android.permission.ACCESS_FINE_LOCATION") == 0;
  }

  public static boolean hasLocationPermission(Context paramContext)
  {
    return (hasFineLocationPermission(paramContext)) || (hasCoarseLocationPermission(paramContext));
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.inmobi.commons.thinICE.location.LocationUtil
 * JD-Core Version:    0.6.2
 */